$(function(){
	var dataTable = $("#bpAboutUsDataTable").DataTable({
		"ajax": {
			"url": '/bpAboutUs/list',
			"data": function(data){
				data.createTime = $("#createTime").val();
				data.status = $("#status").val();
			}
		},
		"ordering": false,
		"columns": [
			{
				"data": "id",
				"className": "text-center sign-col",
				"render": function(data, type, row, meta){
					return '<input type="checkbox" name="pk" value="' + data + '" onclick="checkOne()"/>';
				}
			},
			{"data": "images"},
			{"data": "content"},
			{
				"data": function(obj){
					return new Date(obj.createTime).Format("yyyy-MM-dd");
				} 
			},
			{"data": "status"},
			{"data": "remark"},
			{
				"data": "id",
				"className": "operate-col",
				"render": function(data, type, row, meta){
					var html = '<button type="button" onclick="edit(\''+ data +'\')" class="btn btn-sm btn-warning right-5">'
						+ '<i class="fa fa-edit"></i>'
						+ '</button>'
						+ '<button type="button" onclick="view(\''+ data +'\')" class="btn btn-sm btn-info">'
                    	+ '<i class="fa fa-search"></i>'
                    	+ '</button>';
					return html;
				}
			}
		]
	});
	
	$('#searchBtn').click(function(){
		dataTable.ajax.reload();
	});
	
	$('#resetBtn').click(function(){
		$('#bpAboutUsSearchForm')[0].reset();
		dataTable.ajax.reload();
	});
	
	$('#addBtn').click(function(){
		forwardPage('/bpAboutUs/bpAboutUs');
	});
	
	$('#delBtn').click(function(){
		ajaxBySelecteRows(dataTable,'/bpAboutUs/delete','确定要删除？');
	});
	
	// 日期
	$('.datepicker').datetimepicker({
		language: 'zh-CN',
		format: 'yyyy-mm-dd',
		autoclose: true,
		todayBtn: true,
		clearBtn:true,
		minView: 2
	});
});

function edit(id){
	forwardPage('/bpAboutUs/bpAboutUs?id='+id);
}

function view(id){
	forwardPage('/bpAboutUs/view?id='+id);
}